// +----------------------------------------------------------------------
// | ILDP-three-dimensional系统 [ 致力于通过产品和服务，帮助商家高效化开拓市场 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2021 https://www.lyltop.top All rights reserved.
// +----------------------------------------------------------------------
// | Licensed 这不是一个自由软件，不允许对程序代码以任何形式任何目的的再发行
// +----------------------------------------------------------------------
// | Author: 彦麟工作室 <yanlinstudio@126.com>
// +----------------------------------------------------------------------
// | Name: 刘彦麟
// +----------------------------------------------------------------------
// | FILE_NAME: showFPSMeter.ts
// +----------------------------------------------------------------------
// | Date: 2022/6/14 09:49
// +----------------------------------------------------------------------

import Stats from "three/examples/jsm/libs/stats.module"
/**
 * 显示fps
 *
 * */
const statsFPS = Stats();

export const InitStats = (documents:any) => {
    statsFPS.setMode(0); // 0: fps, 1: ms
    statsFPS.domElement.style.position = 'absolute';
    statsFPS.domElement.style.left = '0px';
    statsFPS.domElement.style.top = '0px';
    //将统计对象添加到对应的元素中
    documents.appendChild(statsFPS.domElement);
}

export const FPSUpdate = () => {
    statsFPS.update();
}

